import { PureComponent } from 'react';
import moment from 'moment';
import {
    Row,
    Col,
    Form,
    Input,
    Select,
    Modal,
    Cascader,
    DatePicker
} from 'antd';
const FormItem = Form.Item;
const { Option } = Select;
import { dicTextByCodePcode,dicListByPcode } from '@/utils/dictionary'


@Form.create()
class CreateForm extends PureComponent {

	constructor(props) {
	    super(props);
	    this.state = {

	    }
	}


	okHandle = () => {
		const { form,handleAdd } = this.props;

	    form.validateFields((err, fieldsValue) => {
		        if (err) return;
		        form.resetFields();

            // 处理时间
            if(fieldsValue.a0253) {
            	fieldsValue.a0253 = moment(fieldsValue.a0253._d).format("YYYY-MM-DD");
            }
            if(fieldsValue.a0243) {
            	fieldsValue.a0243 = moment(fieldsValue.a0243._d).format("YYYY-MM-DD");
            }
            if(fieldsValue.a0265) {
            	fieldsValue.a0265 = moment(fieldsValue.a0265._d).format("YYYY-MM-DD");
            }
            if(fieldsValue.a0279) {
            	fieldsValue.a0279 = moment(fieldsValue.a0279._d).format("YYYY-MM-DD");
            }
			    handleAdd(fieldsValue,'JobInfo');
		});
	};


	resetButton = () => {

	};

  render() {
    const {form: {getFieldDecorator}, modalVisibleByJobInfo,handleModalVisible} = this.props;

return (
    <Modal
width={800}
destroyOnClose
title="添加职务信息"
visible={modalVisibleByJobInfo}
onOk={this.okHandle}
onCancel={() => handleModalVisible(false,"JobInfo")}
afterClose={() => this.resetButton()}
>
<Form  layout="vertical">
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		      <Col md={12} sm={24}>
		        <FormItem  label="职务名称代码">
		            {getFieldDecorator('a0215', {
		              rules: [{ required: false, message: '请选择'}],
		            })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		                  return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                }):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>

		      <Col md={12} sm={24}>
		        <FormItem  label="职务名称">
		            {getFieldDecorator('a0281', {
		            rules: [{ required: true, message: '请输入1-10个字符的姓名',max: 10}],
		            })(<Input placeholder="1-10个字符"/>)}
		        </FormItem>
		      </Col>



		  </Row>
		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		      <Col md={12} sm={24}>
		        <FormItem  label="职务类别">
		            {getFieldDecorator('a0219',{
		            })(
		            	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            		{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		            			return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            		}):null}
		            	</Select>
		            )}
		        </FormItem>
		      </Col>
		      <Col md={12} sm={24}>
		        <FormItem  label="任职状态">
		            {getFieldDecorator('a0255', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		            		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	}):null}
		            </Select>
		            )}
		        </FormItem>
		      </Col>

		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
		        <FormItem  label="职务层次">
		            {getFieldDecorator('a0221', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		            	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	  	{dicListByPcode('YT') != undefined?dicListByPcode('YT').map((item,index) => {
		            	  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	  	}):null}
		            	  </Select>
		            )}
		        </FormItem>
		      </Col>

		      <Col md={12} sm={24}>
		        <FormItem  label="多职务主次序号">
		            {getFieldDecorator('a0223',{
		              rules: [{ required: false, message: '1-40个字符！'}],
		            })(
		            	<Input placeholder="1-40个字符" />
		            )}
		        </FormItem>
		      </Col>

		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		      <Col md={12} sm={24}>
		        <FormItem  label="连续任该职起始日期">
		            {getFieldDecorator('a0253', {
		            rules: [{ required: false, message: '请选择'}],
		            	  })(
		            		<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		            		)}
		              </FormItem>
		      </Col>
		      <Col md={12} sm={24}>
		        <FormItem  label="职务说明">
		            {getFieldDecorator('a0217', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('YT') != undefined?dicListByPcode('YT').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>

		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		      <Col md={12} sm={24}>
		        <FormItem  label="批准机关名称">
		            {getFieldDecorator('a0241_1', {
		            rules: [{ required: false, message: '1-40个字符' }],
		            })(<Input placeholder="1-40个字符" />)}
		        </FormItem>
		      </Col>

		     	<Col md={12} sm={24}>
		     	  <FormItem  label="批准机关代码">
		     	      {getFieldDecorator('a0241_2', {
		     	      rules: [{ required: false, message: '1-40个字符' }],
		     	      })(<Input placeholder="1-40个字符" />)}
		     	  </FormItem>
		     	</Col>

		  </Row>
		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		  	<Col md={12} sm={24}>
		  	  <FormItem  label="批准文号">
		  	      {getFieldDecorator('a0245', {
		  	        rules: [{ required: false, message: '1-40个字符'}],
		  	        })(
		  	        <Input placeholder="1-40个字符" />
		  	      )}
		  	  </FormItem>
		  	</Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="任职日期">
		          {getFieldDecorator('a0243', {
		            rules: [{ required: false, message: '请选择'}],
		            	  })(
		            		<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		            		)}
		              </FormItem>
		    </Col>
		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		      <Col md={12} sm={24}>
		        <FormItem  label="任职变动类别">
		            {getFieldDecorator('a0251', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('XX') != undefined?dicListByPcode('XX').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>
		      <Col md={12} sm={24}>
		        <FormItem  label="任职方式">
		            {getFieldDecorator('a0247', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('SZ') != undefined?dicListByPcode('SZ').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>

		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		      <Col md={12} sm={24}>
		        <FormItem  label="是否班子成员">
		            {getFieldDecorator('a0277', {
		            rules: [{ required: false, message: '请选择'}],
		            })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('SZ') != undefined?dicListByPcode('SZ').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>
			<Col md={12} sm={24}>
		        <FormItem  label="班子成员类别">
		            {getFieldDecorator('a0278', {
		              rules: [{ required: false, message: '请选择'}],
		              })(<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                	}):null}
		                </Select>)}
		        </FormItem>
		      </Col>

		  </Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		      <Col md={12} sm={24}>
		        <FormItem  label="是否破格提拔">
		            {getFieldDecorator('a0276', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		          <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		            		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	}):null}
		            </Select>
		          )}
		        </FormItem>
		      </Col>
		      <Col md={12} sm={24}>
		        <FormItem  label="分管工作">
		            {getFieldDecorator('a0229', {
		              rules: [{ required: false, message: '1-13个字符'}],
		            })(<Input placeholder="1-13个字符"/>)}
		        </FormItem>
		      </Col>

		  </Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		     	<Col md={12} sm={24}>
		     	  <FormItem  label="岗位类别">
		     	      {getFieldDecorator('a0231', {
		     	        rules: [{ required: false, message: '请选择'}],
		     	      })(
                  <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
                    	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
                    		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
                    	}):null}
                    </Select>
                )}
		     	  </FormItem>
		     	</Col>
		      <Col md={12} sm={24}>
		          <FormItem  label="集体内排列顺序">
		              {getFieldDecorator('a0225', {
		                rules: [{ required: false, message: '1-13个字符'}],
		              })(<Input placeholder="1-13个字符"/>)}
		          </FormItem>
		      </Col>

		  </Row>
		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col  md={12} sm={24}>
		          <FormItem  label="股级任职时间">

		              {getFieldDecorator('a0279', {
		                rules: [{ required: false, message: '请选择'}],
		              })(<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>)}
		          </FormItem>
		      </Col>

			<Col md={12} sm={24}>
		        <FormItem  label="任职机构名称">
		            {getFieldDecorator('a0201_1', {
		              rules: [{ required: false, message: '1-13个字符'}],
		            })(<Input placeholder="1-13个字符"/>)}
		        </FormItem>
		      </Col>

		  </Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		      <Col md={12} sm={24}>
		        <FormItem  label="任职机构代码">
		            {getFieldDecorator('a0201_2', {
		              rules: [{ required: false, message: '请选择'}],
		            })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>
		      <Col md={12} sm={24}>
		        <FormItem  label="任职机构所在政区">
		            {getFieldDecorator('a0203', {
		              rules: [{ required: false, message: '1-13个字符'}],
		            })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		              		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              	}):null}
		              </Select>
		            )}
		        </FormItem>
		      </Col>

		  </Row>

		  <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		        <Col md={12} sm={24}>
		          <FormItem  label="任职机构隶属关系">
		              {getFieldDecorator('a0205', {
		                rules: [{ required: false, message: '1-13个字符'}],
		              })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                	}):null}
		                </Select>
		              )}
		          </FormItem>
		        </Col>
		        <Col md={12} sm={24}>
		          <FormItem  label="任职机构名称类别">
		              {getFieldDecorator('a0201_3', {
		                rules: [{ required: false, message: '1-13个字符'}],
		              })(
		              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                	}):null}
		                </Select>
		              )}
		          </FormItem>
		        </Col>

		    </Row>

		    <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		          <Col md={12} sm={24}>
		            <FormItem  label="任职机构性质类别">
		                {getFieldDecorator('a0209', {
		                  rules: [{ required: false, message: '1-13个字符'}],
		                })(
		                <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                  	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                  	}):null}
		                  </Select>
		                )}
		            </FormItem>
		          </Col>
		          <Col md={12} sm={24}>
		            <FormItem  label="任职机构所属行业">
		                {getFieldDecorator('a0211', {
		                  rules: [{ required: false, message: '1-13个字符'}],
		                })(

		                <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                  	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                  	}):null}
		                  </Select>
		                  )}
		            </FormItem>
		          </Col>

		      </Row>

		      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		            <Col md={12} sm={24}>
		              <FormItem  label="任职机构级别">
		                  {getFieldDecorator('a0207', {
		                    rules: [{ required: false, message: '1-13个字符'}],
		                  })(
		                  <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                  	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                  	}):null}
		                  </Select>

		                  )}
		              </FormItem>
		            </Col>
		            <Col md={12} sm={24}>
		              <FormItem  label="批准免职机关名称">
		                  {getFieldDecorator('a0263_1', {
		                    rules: [{ required: false, message: '1-13个字符'}],
		                  })(<Input placeholder="1-13个字符"/>)}
		              </FormItem>
		            </Col>

		        </Row>


		        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		              <Col md={12} sm={24}>
		                <FormItem  label="批准免职机关代码">
		                    {getFieldDecorator('a0263_2', {
		                      rules: [{ required: false, message: '1-13个字符'}],
		                    })(<Input placeholder="1-13个字符"/>)}
		                </FormItem>
		              </Col>
		              <Col md={12} sm={24}>
		                <FormItem  label="批准免职文号">
		                    {getFieldDecorator('a0267', {
		                      rules: [{ required: false, message: '1-13个字符'}],
		                    })(<Input placeholder="1-13个字符"/>)}
		                </FormItem>
		              </Col>

		          </Row>

		          <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		                <Col md={12} sm={24}>
		                  <FormItem  label="免职原因类别">
		                      {getFieldDecorator('a0271', {
		                        rules: [{ required: false, message: '1-13个字符'}],
		                      })(
		                      <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		                        	{dicListByPcode('AT') != undefined?dicListByPcode('AT').map((item,index) => {
		                        		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		                        	}):null}
		                        </Select>
		                      )}
		                  </FormItem>
		                </Col>
		                <Col md={12} sm={24}>
		                  <FormItem  label="股级">
		                      {getFieldDecorator('a0280', {
		                        rules: [{ required: false, message: '1-13个字符'}],
		                      })(<Input placeholder="1-13个字符"/>)}
		                  </FormItem>
		                </Col>

		            </Row>


		            <Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		                  <Col md={12} sm={24}>
		                    <FormItem  label="批准免职日期">
		                        {getFieldDecorator('a0265', {
		                          rules: [{ required: false, message: '1-13个字符'}],
		                          	  })(
		                          		<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		                          		)}
		                            </FormItem>
		                  </Col>

		              </Row>
    	{/*<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

	        <Col md={12} sm={24}>
	          <FormItem  label="是否第一学历">
	              {getFieldDecorator('first_education_type',{
	              	rules: [{ required: true,message: '请选择' }],
	              })(
	              	<Select placeholder="请选择" style={{ width: '100%' }}>
	                    <Select.Option key="1">是</Select.Option>
	                    <Select.Option key="0">否</Select.Option>
	                </Select>
	              )}
	          </FormItem>
	        </Col>

    	</Row>*/}

</Form>
</Modal>
);
  }

}

export default CreateForm;
